package aps

import glory.xxd.Utils

/**
 * 登录
 */
class ClientLoginController {

    def commentService

    def index() {

        def USERNAME = params.USERNAME ?: ""
        def PASSWORD = params.PASSWORD ?: ""
        def AREA = params.AREA ?: ""
        //add by bunny 5.20 设备状态切换增加验证
        def LOGINTYPE = params.LOGINTYPE ?: ""
        def SUBSTATUS = params.SUBSTATUS ?: ""
        def LOGGEDUSER = params.LOGGEDUSER ?: ""
        def FROMSUBSTATUS = params.FROMSUBSTATUS ?: ""
        def ENGINEERNAME = params.ENGINEERNAME ?: ""
        def ENGINEERPASSWORD = params.ENGINEERPASSWORD ?: ""


        def body = CommentParams.newInstance()
        body.setUSERNAME(USERNAME)
        body.setPASSWORD(PASSWORD)
        body.setAREA(AREA)
        body.setLOGINTYPE(LOGINTYPE)
        body.setSUBSTATUS(SUBSTATUS)
        body.setLOGGEDUSER(LOGGEDUSER)
        body.setFROMSUBSTATUS(FROMSUBSTATUS)
        body.setENGINEERNAME(ENGINEERNAME)
        body.setENGINEERPASSWORD(ENGINEERPASSWORD)

        String logUUID = Utils.getUUID();
        Header header = Header.newInstance()
        header.setMESSAGENAME("ClientLogin");
        header.setTRANSACTIONID(logUUID);
        header.setUSERNAME("ClientMonitor")
        def json = commentService.getJsonByObjectForQueue2Queue(logUUID,header,body)

        print json
        //Utils.testGetJson(xmlReturn)
        render  json
    }
}